#include <iostream>
#include <memory.h>
#include <string>

class PersonBuilder
{
public:
    virtual void buildHead() {}
    virtual void buildBody() {}
    virtual void buildArm() {}
    virtual void buildLeg() {}
    PersonBuilder() {}
    PersonBuilder(std::string g, std::string p)
    {
        this->g = g;
        this->p = p;
    }
    virtual ~PersonBuilder(){};

    std::string g, p;
};

class PersonThinBuilder : public PersonBuilder
{
public:
    PersonThinBuilder(std::string g, std::string p)
    {
        this->g = g;
        this->p = p;
    }
    void buildHead()
    {
        std::cout << "瘦子 画头" << std::endl;
    }
    void buildBody()
    {
        std::cout << "瘦子 画身体" << std::endl;
    }
    void buildArm()
    {
        std::cout << "瘦子 画胳膊" << std::endl;
    }
    void buildLeg()
    {
        std::cout << "瘦子 画大腿" << std::endl;
    }
};

class PersonFatBuilder : public PersonBuilder
{
public:
    PersonFatBuilder() {}
    PersonFatBuilder(std::string g, std::string p)
    {
        this->g = g;
        this->p = p;
    }

    void buildHead()
    {
        std::cout << "胖子 画头" << std::endl;
    }
    void buildBody()
    {
        std::cout << "胖子 画身体" << std::endl;
    }
    void buildArm()
    {
        std::cout << "胖子 画胳膊" << std::endl;
    }
    void buildLeg()
    {
        std::cout << "胖子 画大腿" << std::endl;
    }
};

class PersonDirector
{
public:
    PersonDirector(PersonBuilder *pb)
    {
        this->pb = pb;
    }
    void createPerson()
    {
        pb->buildHead();
        pb->buildBody();
        pb->buildArm();
        pb->buildLeg();
    }

private:
    PersonBuilder *pb;
};

int main()
{

    PersonThinBuilder *pt = new PersonThinBuilder("画瘦子", "红笔");
    PersonDirector *pd = new PersonDirector(pt);
    pd->createPerson();

    return 0;
}